﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using SaleManagement.Web.App_Code;

namespace SaleManagement.Web.MasterPages
{
  public partial class Default : System.Web.UI.MasterPage
  {
    #region Events
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!Page.IsPostBack && !Page.IsCallback)
      {
        string script = "<script type='text/javascript'>ShowRealTime()</script>";
        if (!Page.ClientScript.IsStartupScriptRegistered(GetType(), "CurrentDateTime"))
        {
          Page.ClientScript.RegisterStartupScript(GetType(), "CurrentDateTime", script);
        }

        lblUserName.InnerHtml = (Page as BasePage).CurrentUser.Username;
      }
    }

    protected void hbtLogout_Click(object sender, EventArgs e)
    {
      Session.RemoveAll();
      Response.Redirect("~/Pages/Login.aspx", false);
    }
    #endregion
  }
}
